// 简单的测试JavaScript代码
const x = 10;
const y = 20;
const sum = x + y;
console.log("Sum:", sum);

// 变量声明和赋值
let a = 5;
a = a * 2;
console.log("a =", a);

// 字符串操作
const greeting = "Hello, ";
const name = "JavaScript Engine";
console.log(greeting + name);

// 条件语句
if (sum > 25) {
  console.log("Sum is greater than 25");
} else {
  console.log("Sum is not greater than 25");
}

// 函数定义和调用
function factorial(n) {
  if (n <= 1) {
    return 1;
  }
  return n * factorial(n - 1);
}

console.log("5! =", factorial(5));

// 数组操作
const numbers = [1, 2, 3, 4, 5];
let total = 0;
for (let i = 0; i < numbers.length; i++) {
  total = total + numbers[i];
}
console.log("Array sum:", total); 